/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.swta;

import org.apache.wicket.model.AbstractPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

/**
 *
 * @param <Boolean> 
 * @param <java>
 * @author Jan Korreck
 */
public class ItemContainsModel extends PropertyModel {

    
    MyItemPackage itemPackage;
    String itemID = "";
    Object model;
    
    public ItemContainsModel(Object itemPackage, String itemID) {
        super(itemPackage, "reserved");
        this.itemID = itemID;
        this.model = itemPackage;
        this.itemPackage = (MyItemPackage) itemPackage;
    }

    @Override
    public Object getObject() {

        boolean test = itemPackage.containsItem(this.itemID);
        System.out.println("_________GET OBJECT: " + test);
        return new Boolean(test);
    }

    @Override
    public void setObject(Object object) {
        System.out.println("_________SET OBJECT: " + object.toString());
        super.setObject(this.model);
    }

    @Override
    public void setChainedModel(IModel model) {
        System.out.println("_____________ SET CHAINED MODEL: " + model.toString());
        super.setChainedModel(model);
    }


}